-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(mwlResizeHandle): add resizableContainer
input
#128
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one, thank you for this! Just one small question
src/resizable.directive.ts
Outdated
@@ -416,7 +422,7 @@ export class ResizableDirective implements OnInit, OnChanges, OnDestroy { | |||
this.mousemove | |||
).pipe( | |||
tap(({ event }) => { | |||
if (currentResize) { | |||
if (currentResize && event.defaultPrevented) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be !event.defaultPrevented
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I investigated in this topic a bit more and found put that I just blindly copypasted from some stackoverflow 😅
and this field does not actually reflect passive eventlistener
The truth is there is no field to say that, so the only workaround is to add try-catch
src/resize-handle.directive.ts
Outdated
@@ -43,9 +53,9 @@ export class ResizeHandleDirective implements OnInit, OnDestroy { | |||
|
|||
constructor( | |||
private renderer: Renderer2, | |||
private element: ElementRef, | |||
public element: ElementRef, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just made it public for unit tests sake
no real need, just saw same pattern in ResizableDirective and decided to shortcut same way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK can we keep it private and get the element a different way in the test (via querySelector
or debugElement
). Users have an annoying way of using all the apis you didn't expect to expose 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
totally agree, updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!! 🙌
resizableContainer
input
Released as |
Hi!
I have added few changes
preventDefault
on an event cause it causes errors if project where this directive is used has passive listeners on same eventCurrent architecture demands this structure:
I added possibility to have divs on one level (this is optional)